package com.leetroll.app.service.impl;

import com.leetroll.app.config.WePayConfig;
import com.leetroll.app.service.WePayService;
import com.leetroll.common.entity.Order;
import com.yungouos.pay.wxpay.WxPay;
import org.springframework.stereotype.Component;

@Component
public class WePayServiceImpl implements WePayService {

    @Override
    public String nativePay(Order order) {
//        String notifyUrl = "https://18u10292i7.vicp.fun/app/pay/callback";
        String notifyUrl = "http://www.leetroll.com/app/pay/callback";
        return WxPay.nativePay(order.getBatchCode(),
                String.valueOf(order.getTotalPrice()),
                WePayConfig.mchId,
                order.getBody(),
                "1",
                null, null,
                notifyUrl,
                null, null, null, null, null,
                WePayConfig.KEY);
    }
}
